		TITLE	SEARCH_ENTRYNAME - Copyright (C) 1994 SLR Systems

		INCLUDE	MACROS
		INCLUDE	SEGMSYMS

if	fg_segm

		PUBLIC	SEARCH_ENTRYNAME


		.DATA

		EXTERNDEF	SYMBOL_TEXT:BYTE

		EXTERNDEF	SYMBOL_LENGTH:DWORD

		EXTERNDEF	ENTRYNAME_STUFF:ALLOCS_STRUCT,ENTRYNAME_GARRAY:STD_PTR_S


		.CODE	PASS1_TEXT


SEARCH_ENTRYNAME	PROC				;USED BY INSTALL_ENTRYNAME, AND ALSO OLD-PROCESSING
		;
		;EDX IS TEXT HASH VALUE, RETURN EAX IS INDEX, ECX IS PHYSICAL
		;
		MOV	EAX,EDX
		XOR	EDX,EDX

		HASHDIV	ENTRYNAME_STUFF.ALLO_HASH	;EDX IS HASH VALUE

		PUSH	EBX
		MOV	EBX,ENTRYNAME_STUFF.ALLO_HASH_TABLE_PTR

		PUSHM	EDI,ESI

		MOV	EAX,[EBX+EDX*4]
		LEA	EBX,[EBX+EDX*4-ENT_STRUCT._ENT_NEXT_HASH_GINDEX]
TRY_NAME_NEXT:
		TEST	EAX,EAX
		JZ	L9$

		MOV	EBX,EAX
		MOV	EDX,EAX

		CONVERT	EBX,EBX,ENTRYNAME_GARRAY
		ASSUME	EBX:PTR ENT_STRUCT
		;
		;PROBABLE MATCH, NEED COMPARE...
		;
		MOV	ECX,SYMBOL_LENGTH
		MOV	EDI,OFF SYMBOL_TEXT
		;
		;ASSUME ENTRIES ARE PASCAL, CASE IGNORE
		;
		SHR	ECX,2
		LEA	ESI,[EBX]._ENT_TEXT

		INC	ECX
		MOV	EAX,[EBX]._ENT_NEXT_HASH_GINDEX	;NEXT INDEX HASH ORDER

		REPE	CMPSD

		JNZ	TRY_NAME_NEXT

		POPM	ESI,EDI

		MOV	ECX,EBX
		POP	EBX

		MOV	EAX,EDX			;AX = INDEX, DS:BX IS PHYSICAL

		RET

L9$:
		MOV	ECX,EBX
		CMP	ESP,-1

		POPM	ESI,EDI,EBX

		RET

SEARCH_ENTRYNAME	ENDP

endif

		END

